<? $urlOptions = array ('module' => 'admin', 'controller' => 'stat', 'action' => 'add'); ?>
<form id="stat" action="<?= $this->url($urlOptions) ?>" onSubmit="return saveRow(this);" method="post">
<table id="statList" class="toonStatList" cellspacing="0" cellpadding="3">
   <thead>
      <tr>
	      <th>State Name</th>
	      <th>Min</th>
	      <th>Max</th>
	      <th width="20px"></th>
      </tr>
   </thead>
   <tbody>
      <tr>
         <td valign="middle"><?= $this->formText('stat_name', 'Stat Name', array('size' => 15, 'onfocus' => "check_focus(this, 'Stat Name')", 'onblur' => "check_blur(this, 'Stat Name')")); ?></td>
         <td valign="middle"><?= $this->formText('stat_min', 'Min Value', array('size' => 10, 'onfocus' => "check_focus(this, 'Min Value')", 'onblur' => "check_blur(this, 'Min Value')")); ?></td>
         <td valign="middle"><?= $this->formText('stat_max', 'Max Value', array('size' => 10, 'onfocus' => "check_focus(this, 'Max Value')", 'onblur' => "check_blur(this, 'Max Value')")); ?></td>
         <td width="20px"><?= $this->formSubmit('submit', '+'); ?></td>
      </tr>
<? $i = 0;
$optionsCopy = $urlOptions; 
$optionsCopy['controller'] = 'confirm';
$optionsCopy['action'] = 'deleterow';
$optionsCopy['c'] = 'stat';
   foreach ( $this->stats as $row ): 
      $optionsCopy['i'] = $row['id'] ?>
      <tr id="stat_<?= $row['id'] ?>" class="<?= $i++ % 2 ? 'even' : 'odd' ?>">
         <td valign="middle"><?= $row['name'] ?></td>
         <td valign="middle"><?= $row['min_value'] ?></td>
         <td valign="middle"><?= $row['max_value'] ?></td>
         <td style="text-align: center">
            <a href="<?= $this->url($optionsCopy)?>" onClick="return deleteRow('stat','<?=$row['id']?>');"><img 
               id="stat_<?=$row['id']?>_img" src="/tools/images/delete_16.png" border="0" height="16" width="16" /></a>
         </td>
      </tr>
<? endforeach; ?>
   </tbody>
</table>
</form>
